package com.zmzncs.lmtc.module.customer.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zmzncs.lmtc.common.pojo.PageVO;
import com.zmzncs.lmtc.common.pojo.Rest;
import com.zmzncs.lmtc.common.util.JsonUtil;
import com.zmzncs.lmtc.common.util.RestUtil;
import com.zmzncs.lmtc.module.customer.pojo.card_park.CardParkDTO;
import com.zmzncs.lmtc.module.customer.pojo.card_park.CardParkVO;
import com.zmzncs.lmtc.module.customer.service.CardParkService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotNull;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 任建波
 * @since 2020-08-27
 */
@Api(tags = "车辆服务实时状态关联的停车场")
@RestController
@RequestMapping("/customer/card-park")
@Validated
public class CardParkController {

    @Autowired
    CardParkService cardParkService;

    @ApiOperation(value = "获取车辆服务实时状态关联的停车场")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", name = "token", value = "请求头token", required = true),
            @ApiImplicitParam(paramType="query", name = "currentPage", value = "页码", required = true),
            @ApiImplicitParam(paramType="query", name = "pageSize", value = "每页记录数", required = true),
            @ApiImplicitParam(paramType="query", name = "cardId", value = "车辆服务实时状态id", required = true),
            @ApiImplicitParam(paramType="query", name = "keyword", value = "查询关键字"),
    })
    @GetMapping(value = "/getCardParkList")
    public Rest<PageVO<CardParkVO>> getCardParkList(@NotNull Integer currentPage, @NotNull Integer pageSize, @NotNull Integer cardId, String keyword) {
        IPage<CardParkDTO> cardParkList = cardParkService.getCardParkList(currentPage, pageSize, cardId, keyword);

        PageVO<CardParkVO> cardParkVOPageVO = JsonUtil.pageTransform(cardParkList, CardParkVO.class);
        return RestUtil.success(cardParkVOPageVO);
    }


}

